package com.rt.java.time;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

public class LocalDateTimeDemo {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        now.plusYears(1); // 加一年
        now.minusHours(1); // 减一小时
        now.withMonth(2); // 修改月
        now.isBefore(now.plusDays(1)); // true
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String format = dtf.format(now); // 2025-10-04 14:08:00
    }
}
